Conversation
…within on tx promoted hook instead of directly within legacypool
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #1060 +/- ##
==========================================
- Coverage 65.45% 63.72% -1.73%
==========================================
Files 331 331
Lines 23262 23704 +442
==========================================
- Hits 15225 15106 -119
- Misses 6894 7144 +250
- Partials 1143 1454 +311
🚀 New features to boost your workflow:
|
Greptile SummaryThis PR introduces Key changes:
Confidence Score: 3/5
Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[configureEVMMempool] --> B{GetShouldOperateExclusively?}
B -- true --> C[KrakatoaMempool]
B -- false --> D[ExperimentalEVMMempool]
C --> E[SetInsertTxHandler]
C --> F[SetReapTxsHandler]
C --> G[SetPrepareProposal\nNoCheckTxVerifier]
C --> H[SetMempool]
C --> I[NOT SetCheckTxHandler]
D --> J[SetCheckTxHandler]
D --> K[SetPrepareProposal\napp verifier]
D --> L[SetMempool]
D --> M[NOT SetInsertTxHandler/ReapTxs]
C --> N[KrakatoaMempool.InsertAsync]
N --> O{EVM tx?}
O -- yes --> P[evmInsertQueue async]
O -- no --> Q[cosmosInsertQueue async\n⚠️ errors silently dropped]
C --> R[VMKeeperI.SetEvmMempool\nNotifiedMempool interface]
D --> R
|
| var ErrQueueFull = errors.New("queue full") | ||
|
|
||
| // New creates a new queue. | ||
| func New[Tx any](insert func(txs []*Tx) []error, maxSize int, logger log.Logger) *Queue[Tx] { |
There was a problem hiding this comment.
the name of this mock was wrong (missing the I on the interface)
| // The transactions can also be pre-filtered by the dynamic fee components to | ||
| // reduce allocations and load on downstream subsystems. | ||
| func (pool *LegacyPool) Pending(ctx context.Context, height *big.Int, filter txpool.PendingFilter) map[common.Address][]*txpool.LazyTransaction { | ||
| func (pool *LegacyPool) Rechecked(ctx context.Context, height *big.Int, filter txpool.PendingFilter) map[common.Address][]*txpool.LazyTransaction { |
There was a problem hiding this comment.
the ExperimentalEVMMempool calls Pending and the KrakataoMempool calls Rechecked.
| // enough for the miner and other APIs to handle large batches of transactions; | ||
| // and supports pulling up the entire transaction when really needed. | ||
| type LazyTransaction struct { | ||
| Pool LazyResolver // Transaction resolver to pull the real transaction up |
There was a problem hiding this comment.
unused and made the filterAndWrapTxs helper have an extra param, so I removed it
There was a problem hiding this comment.
moved all krakatoa specific features into here. there is a bit of code duplication between this and the experimental evm mempool still. if we think it is worth breaking the common pieces out into more helper functions or a shared embedded struct, I can address in another pr
There was a problem hiding this comment.
all of the mempool tests were specific to krakatoa, so moved them to krakatoa_mempool_test.go
|
|
||
| // RemoveTx removes a tx from the tx tracker and does not record any metrics as | ||
| // it exits the tracker. | ||
| func (txt *txTracker) RemoveTx(hash common.Hash) { |
| // handler for InsertTx, since the ABCI handler obfuscates the error's | ||
| // returned via codes, and we would like to have the full error to | ||
| // return to clients. | ||
| err := b.Mempool.Insert(b.Application.GetContextForCheckTx(txBytes), cosmosTx) |
There was a problem hiding this comment.
internally the mempool will use the context on the rechecker to run any validation that is happening during insert tx, so there is no need to specifically get the check context
technicallyty
left a comment
There was a problem hiding this comment.
LGTM, although i skimmed a fair chunk here. seems like it was mostly moving stuff around, the feature flag, and then a bunch of stray clean ups. unsure if there is anything delicate that changed. if theres anything you think needs particularly careful attention lmk. otherwise ill approve
| mempoolConfig, err := app.createMempoolConfig(appOpts, logger) | ||
| if err != nil { | ||
| return fmt.Errorf("failed to get mempool config: %w", err) | ||
| if server.GetShouldOperateExclusively(appOpts, logger) { |
There was a problem hiding this comment.
Wondering if we could completely move these out now that we have configs for this and a flag to turn this on and off. Is there any real reason for keeping this setup logic directly in people's applications? This was already here, so maybe better to track in a separate issue if you agree with this.
There was a problem hiding this comment.
I'm not 100% sure what you mean by this, where would it move to? fetching the flags and populating the config feels like a responsibility of evmd not the evm library
|
I wanted to add another comment reiterating that I think it's pretty confusing to know when to use "app" vs. "flood" in the mempool, and we should think of a way to enforce one or the other depending on what mempool gets selected |
yeah I agree, we'll probably need to make it a change to |
Description
This PR adds a flag
evm.mempool.operate-exclusivelythat will enable theKrakatoaMempoolfeatures. These features have been pulled out of theExperimentalEVMMempooland into their own struct inkrakatoa_mempool.go.Mempool related system and integration tests now run two copies, they run once on the
ExperimentalEVMMempool+ CometBFTfloodmempool, and once on theKrakatoaMempool+ CometBFTappmempool.One slight modification was made to the
ExperimentalEVMMempoolthough, when interacting with thelegacypool, both mempools use the lifecycle hooks instead of directly modifying thelegacypool. TheExperimentalEVMMempoolcalls theBroadcastTxFnwhen a tx is promoted via theonTxPromotedhook, instead of passing theBroadcastTxFninto thelegacypoolitself.Closes: STACK-2091
Author Checklist
All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow up issues.
I have...
mainbranch